package com.zlh.config;

import org.apache.rocketmq.acl.common.AclClientRPCHook;
import org.apache.rocketmq.acl.common.SessionCredentials;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.remoting.RPCHook;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class Config {

    private long sleepTime = 1200000L;

    public void setSleepTime(long st) {
        this.sleepTime = st;
    }

    public long getSleepTime() {
        return sleepTime;
    }

//    @Value("${rocketmq.name-server}")
//    private String nameServer;
//
//    @Value("${rocketmq.producer.group}")
//    private String producerGroup;
//
//    @Value("${rocketmq.acl.access-key}")
//    private String accessKey;
//
//    @Value("${rocketmq.acl.secret-key}")
//    private String secretKey;
//
//    @Bean
//    public DefaultMQProducer rocketMQProducer() {
//        // 配置访问凭据
//        RPCHook rpcHook = new AclClientRPCHook(new SessionCredentials(accessKey, secretKey));
//
//        DefaultMQProducer producer = new DefaultMQProducer(rpcHook);
//        producer.setProducerGroup(producerGroup);
//        producer.setNamesrvAddr(nameServer);
//        
//        return producer;
//    }
//
//    @Bean
//    public RocketMQTemplate rocketMQTemplate(DefaultMQProducer producer) {
//        RocketMQTemplate template = new RocketMQTemplate();
//        template.setProducer(producer);
//        return template;
//    }
}
